package org.team751.commands;


public class ForkliftJoystickControl extends CommandBase {

	protected static final double kJoystickThreshold = 0.1;
        
        public ForkliftJoystickControl(){
            requires(forklift);
        }
	
	protected void initialize() {
            
	}

	protected void execute() {
		double joystickValue = oi.getForkliftGripperStick().getY();
		//check for negative (forward) value to move up
		if(joystickValue < -kJoystickThreshold){
			forklift.setRelaysUp();
		}else if(joystickValue > kJoystickThreshold){//check for positive (backwards) value to move down
			forklift.setRelaysDown();
		}else{
			forklift.stop();//Absolute value of joystick is less that joystick threshold. stop
		}
	}

	protected boolean isFinished() {
		return false;
	}

	protected void end() {
		forklift.stop();
	}

	protected void interrupted() {
		end();

	}

}
